<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="common/header.jsp" %>	
<div class="clearfix"></div>
<div class="row">
  <div class="col-md-12 col-sm-12 col-xs-12">
    <div class="x_panel">
      <div class="x_title">
        <h2>修改学生信息 <i class="fa fa-user"></i></h2>
             <div class="clearfix"></div>
      </div>
      <div class="x_content">
        <form class="form-horizontal form-label-left" action="updatestudent.html" method="post" enctype="multipart/form-data">
        	
        	<input type="hidden" name="id" value="${student.id}" />
        	
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">姓名 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input id="softwareName" class="form-control col-md-7 col-xs-12" 
               data-validate-length-range="20" data-validate-words="1" 
               name="studentName" value="${student.studentName}" required="required"
               placeholder="请输入姓名" type="text">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12"  for="select">性别<span class="required">*</span></label>
            <div class="col-md-6 col-sm-6 col-xs-12" >
            	<c:if test="${student.sex == 1}">
            		<input type="radio" name="sex" value="1" checked="checked" required="required">男&emsp;&emsp;&emsp;
            		<input type="radio" name="sex" value="2" required="required">女
            	</c:if>
            	<c:if test="${student.sex == 2}">
            	<input type="radio" name="sex" value="1" required="required">男&emsp;&emsp;&emsp;
            		<input type="radio" name="sex" value="2" checked="checked" required="required">女
            	</c:if>
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">年龄 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input id="sex" type="text" class="form-control col-md-7 col-xs-12" 
              placeholder="请输入年龄" name="age" value="${student.age}" required="required">
            </div>
          </div>
          
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">电话 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input id="supportROM" class="form-control col-md-7 col-xs-12" 
              	name="phone" value="${student.phone}" required="required"
              	data-validate-length-range="20" data-validate-words="1" 
              	placeholder="请输入电话号码" type="text">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">现今住址<span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input id="interfaceLanguage" class="form-control col-md-7 col-xs-12" 
              data-validate-length-range="20" data-validate-words="1"  required="required"
              name="address" value="${student.address}"
              placeholder="请输入住址" type="text">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="number">身份证号<span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input type="text" id="identityCard" name="identityCard" value="${student.identityCard}" required="required"
              data-validate-minmax="10,500"  placeholder="请输身份证号" class="form-control col-md-7 col-xs-12">
            </div>
          </div>
          
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="number">出生日期 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input type="text" id="downloads" name="birthday" value="${student.birthday.toLocaleString().substring(0,8)}" required="required"
               placeholder="请输入出生日期" class="form-control col-md-7 col-xs-12">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12"  for="select">课程 <span class="required">*</span></label>
            <div class="col-md-2 col-sm-3 col-xs-12">
            	<select name="subject" id="subject" class="form-control col-md-7 col-xs-12" required="required">
            		<option value="${student.grade.subject.id}">${student.grade.subject.subjectName}</option>
            		<c:forEach var="subject" items="${subjectList}">
            			<c:if test="${student.grade.subject.id != subject.id}">
							<option value="${subject.id}">${subject.subjectName}</option>
            			</c:if>
            		</c:forEach>
            	</select>
            </div>
            <label class="control-label col-md-2 col-sm-3 col-xs-12"  for="select">班级<span class="required">*</span></label>
            <div class="col-md-2 col-sm-3 col-xs-12">
            	<select name="gradeId" id="grade" class="form-control col-md-7 col-xs-12" required="required">
            		 <option value="${student.grade.id}" >${student.grade.id}${student.grade.gradeName}</option>
            		 <c:forEach var="grade" items="${gradeList}">
            		 	<c:if test="${student.grade.id != grade.id}">
            		 		<option value="${grade.id}">${grade.gradeName}</option>
            		 	</c:if>
            		 </c:forEach>
            	</select>
            </div>
          </div>
           <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12"  for="select">学历<span class="required">*</span></label>
            <div class="col-md-6 col-sm-6 col-xs-12">
              <input type="text" id="downloads" name="educationBackground" value="${student.educationBackground}" placeholder="请输入学历"
               class="form-control col-md-7 col-xs-12" required="required">
            </div>
          </div>
          <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12"  for="select">计算机了解程度<span class="required">*</span></label>
            <div class="col-md-6 col-sm-6 col-xs-12">
            	<c:if test="${student.computerSavvy == 0}">
           			<input type="radio" name="computerSavvy" checked="checked" value="0" required="required">零基础&emsp;&emsp;&emsp;
	            	<input type="radio" name="computerSavvy" value="1" required="required">一般&emsp;&emsp;&emsp;
	            	<input type="radio" name="computerSavvy" value="2" required="required">资深&emsp;&emsp;&emsp;
            	</c:if>
            	<c:if test="${student.computerSavvy == 1}">
           			<input type="radio" name="computerSavvy" value="0" required="required">零基础&emsp;&emsp;&emsp;
	            	<input type="radio" name="computerSavvy" checked="checked" value="1" required="required">一般&emsp;&emsp;&emsp;
    	        	<input type="radio" name="computerSavvy" value="2" required="required">资深&emsp;&emsp;&emsp;
            	</c:if>
            	<c:if test="${student.computerSavvy == 2}">
           			<input type="radio" name="computerSavvy" value="0" required="required">零基础&emsp;&emsp;&emsp;
            		<input type="radio" name="computerSavvy" checked="checked" value="1" required="required">一般&emsp;&emsp;&emsp;
            		<input type="radio" name="computerSavvy" value="2" required="required">资深&emsp;&emsp;&emsp;
            	</c:if>
            	
            </div>
          </div>
          <div class="form-group">
            <div class="col-md-6 col-md-offset-3">
              <input id="send" type="submit" class="btn btn-success" value="保存"/>
              <button type="button" class="btn btn-primary" id="back">返回</button>
              <br/><br/>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>

<script type="text/javascript" src="${pageContext.request.contextPath}/bdqnFoledr/statics/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
	$(function(){
		function selectGrade(){
			var subjectId = $("#subject");
     		$.ajax({
			   type:"GET",
			   url:"/ApplySystem/user/getGradeBySubjectId.json",
			   data: {subjectId:subjectId.val()},
			   dataType : "json",
			   scriptCharset: "UTF-8",
			   success:function(data){
			   		$("#grade").html("");
					var options = "<option value=\"\">请选择班级</option>";
					for(var i = 0; i < data.result.length; i++){
						options += "<option value=\""+data.result[i].id+"\">"+data.result[i].gradeName+"</option>";
					}
					$("#grade").html(options);
			   },
			   error:function(data){
			   		alert("请求异常");
			   }
			});
      	}
		$("#subject").change(selectGrade);
	});
</script>

<%@ include file="common/footer.jsp" %>
